<template>
  <div class="serach">
    <van-search
      placeholder="搜索更多商品"
      style="width: 90%; height: 40px; marign-top: -20px"
      shape="round"
      @click="$router.push('/shopSearch')"
    />
    <van-icon
      :badge="num"
      size="25"
      name="shopping-cart-o"
      @click="$router.push('/shop/cart')"
    />
  </div>
</template>
<script setup>
import { ref } from "vue";
import { useRouter } from "vue-router";
import { getCartLists, getCarts } from "../../API";
import { useCount } from "../../store";
let num = ref(null);
let router = useRouter();

let getNums = async () => {
  let { data } = await getCarts();
  // console.log(data.data);
  num.value = data.data.sku_count;
  console.log(num.value);
};
getNums();
</script>

<style scoped>
.serach {
  width: 100%;
  box-sizing: border-box;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin-top: 20px;
}
</style>